	.text
.global fact
.type fact,@function
fact:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$4,%esp
	leal	-4(%ebp), %eax
	pushl	%eax
	leal	8(%ebp), %eax
	movl	(%eax), %eax
	popl	%ebx
	movl	%eax, 0(%ebx)
	leal	-4(%ebp), %eax
	movl	(%eax), %eax
	cmpl	$0, %eax
	je	.Etiq1
	jmp	.Etiq0
.Etiq0:
	leal	8(%ebp), %eax
	movl	(%eax), %eax
	pushl	%eax
	movl	$1, %eax
	movl	%eax, %ebx
	popl	%eax
	subl	%ebx, %eax
	pushl	%eax
	call	fact
	addl	$4,%esp
	pushl	%eax
	leal	8(%ebp), %eax
	movl	(%eax), %eax
	popl	%ebx
	imull	%ebx, %eax
	jmp	.epilogo_fact
.Etiq1:
	movl	$1, %eax
	jmp	.epilogo_fact
.epilogo_fact:
	movl	%ebp, %esp
	popl	%ebp
	ret
	.text
.global main
.type main,@function
main:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$12,%esp
	movl	$x, %eax
	pushl	%eax
	movl	$6, %eax
	popl	%ebx
	movl	%eax, 0(%ebx)
	movl	$x, %eax
	movl	(%eax), %eax
	pushl	%eax
	call	fact
	addl	$4,%esp
	pushl	%eax
	movl	$x, %eax
	movl	(%eax), %eax
	pushl	%eax
	movl	$.S0, %eax
	pushl	%eax
	call	printf
	addl	$12,%esp
	leal	-4(%ebp), %eax
	pushl	%eax
	movl	$4, %eax
	popl	%ebx
	movl	%eax, 0(%ebx)
	leal	-8(%ebp), %eax
	pushl	%eax
	movl	$8, %eax
	popl	%ebx
	movl	%eax, 0(%ebx)
	leal	-12(%ebp), %eax
	pushl	%eax
	leal	-4(%ebp), %eax
	pushl	%eax
	movl	(%eax), %eax
	incl	%eax
	popl	%ebx
	movl	%eax, 0(%ebx)
	decl	%eax
	pushl	%eax
	leal	-8(%ebp), %eax
	movl	(%eax), %eax
	popl	%ebx
	cdq
	divl	%ebx
	movl	%edx, %eax
	popl	%ebx
	movl	%eax, 0(%ebx)
	leal	-12(%ebp), %eax
	movl	(%eax), %eax
	pushl	%eax
	leal	-8(%ebp), %eax
	movl	(%eax), %eax
	pushl	%eax
	movl	$.S1, %eax
	pushl	%eax
	call	printf
	addl	$12,%esp
	leal	-4(%ebp), %eax
	movl	(%eax), %eax
	pushl	%eax
	movl	$.S2, %eax
	pushl	%eax
	call	printf
	addl	$8,%esp
.epilogo_main:
	movl	%ebp, %esp
	popl	%ebp
	ret
.section .data
.comm x, 4, 4
.comm y, 4, 4
.section	.rodata
.S1:	.string	"Resto de %d y 4 es: %d\n"
.S2:	.string	"Variable 'a' fue post incrementada a %d\n"
.S0:	.string	"factorial(%d) = %d\n"
